package com.zhengqing.design.structure.composite._01;

import lombok.Data;
import org.assertj.core.util.Lists;

import java.util.List;

/**
 * <p> 员工 </p>
 *
 * @author zhengqingya
 * @description
 * @date 2022/12/22 9:31
 */
@Data
public class Employee {
    private String name;
    private String dept;
    private List<Employee> subordinates;

    public Employee(String name, String dept) {
        this.name = name;
        this.dept = dept;
        this.subordinates = Lists.newArrayList();
    }

    public void add(Employee e) {
        this.subordinates.add(e);
    }

    public void remove(Employee e) {
        this.subordinates.remove(e);
    }

    public List<Employee> getSubordinates() {
        return this.subordinates;
    }

}